<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@
taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- 视口标签 -->
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no" />
<!-- 删除苹果默认的工具栏和菜单栏 -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- 设置苹果工具栏颜色 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- 忽略页面中的数字识别为电话，忽略email识别 -->
<meta name="format-detection" content="telphone=no, email=no" />
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">
<!-- 适应移动端end -->
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/base.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/css/index.css" />
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/plugin/TouchSlide.1.1.js"></script>
<title>登录</title>
</head>
<body>
	<div class="wrap">
		<section class="login_content">
			<div class="login_bg">
				<img src="${designer.desHeadimgurl}" class="logo_gr" alt="" />
			</div>
			<form action="" class="login_form" id="login_form">
				<input type="hidden" name="desOpenid" value="${designer.desOpenid}">
				<div class="login_txt bor-t">
					<i class="login_icon"></i> <input type="text" placeholder="请输入手机号"
						class="input_con" name="desAccount" data-filtermsg="手机号格式不正确！"
						data-filter="^13[0-9]{9}$|^14[0-9]{9}$|^15[0-9]{9}$|^16[0-9]{9}$|^17[0-9]{9}$|^18[0-9]{9}$" />
				</div>
				<div class="login_txt">
					<i class="login_icon icon_pwd"></i> <input type="password"
						placeholder="请输入密码" class="input_con" name="desPassword"
						data-filtermsg="密码格式不正确！" data-filter="^[0-9a-zA-Z]{6,20}$" />
				</div>
				<div class="login_btn mar_b" onclick="login()">
					<a href="javascript:;">登录</a>
				</div>
			</form>
		</section>
	</div>
	<script type="text/javascript"
		src="${path }/resource/plugin/layer/layer.js"></script>
	<script type="text/javascript">
		function login() {
			var flag = true;
			$('#login_form input.input_con').each(function(i, item) {
				if (isBlank(item.value)) {
					layer.tips(item.placeholder, item, {
						tips : 1
					});
					flag = false;
					$(item).focus();
					return false;
				} else if (filterReg(item.value, item.dataset.filter)) {
					layer.tips(item.dataset.filtermsg, item, {
						tips : 1
					});
					flag = false;
					$(item).focus();
					return false;
				}
			});

			if (flag) {
				$.ajax({
					type : 'POST',
					url : '${path}/app/doAppLogin',
					data : $('#login_form').serialize(),
					dataType : 'json',
					async : false,
					success : function(res) {
						if (res && res.status == 'ok') {
							window.location.href = '${path}/' + res.page;
						} else {
							layer.msg(res.info, {
								icon : 2,
								time : 1000
							});
						}
					}
				})
			}
		}

		/**判断是否为空*/
		function isBlank(obj) {
			return (!obj || $.trim(obj) === "");
		}

		/**判断格式*/
		function filterReg(val, filter) {
			var reg = new RegExp(filter);
			return !reg.test(val);
		}
	</script>
</body>
</html>